//
//  PublishReportViewController.m
//  suRead
//
//  Created by 李 诗洋 on 15/11/12.
//  Copyright © 2015年 bao. All rights reserved.
//

#import "PublishReportViewController.h"
#import "UIControl+Blocks.h"
#import "PublishReportTableViewController.h"

@interface PublishReportViewController ()
@property (weak, nonatomic) IBOutlet UINavigationItem *customNavigationItem;
@property(nonatomic,weak)PublishReportTableViewController *controller;

@end

@implementation PublishReportViewController

- (void)viewDidLoad {
    [super viewDidLoad];
 
    __weak typeof(self) weak_self = self;

    //右侧爆料按钮
    UIButton *buttonReport = [UIButton buttonWithType:UIButtonTypeCustom];
    buttonReport.titleLabel.font = [UIFont fontWithName:@"FZBIAOYSJW--GB1-0" size:18.0f];
    buttonReport.frame = CGRectMake(0, 0, 50.0f, 25.0f);
    [buttonReport setTitle:@"发布" forState:UIControlStateNormal];
    [buttonReport setBackgroundColor:[UIColor redColor]];
    buttonReport.layer.cornerRadius = 10.0f;
    buttonReport.layer.masksToBounds = YES;
    
    [buttonReport addActionForControlEvents:UIControlEventTouchUpInside usingBlock:^(UIControl *sender, UIEvent *event) {
        [weak_self.controller rebellionSetButtonClick];
    }];

    UIBarButtonItem *submitItem = [[UIBarButtonItem alloc] initWithCustomView:buttonReport];
    self.customNavigationItem.rightBarButtonItem = submitItem;
}

- (IBAction)goBack:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.destinationViewController isMemberOfClass:[PublishReportTableViewController class]]) {
        self.controller = segue.destinationViewController;
    }
}

@end
